import Vue from 'vue'
import VueRouter from 'vue-router'
import MyGoodsList from '@/views/MyGoodsList'
import MyGoodsSearch from '@/views/MyGoodsSearch'
import MyUserInfo from '@/views/MyUserInfo'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/goodList'
  },
  {
    path: '/goodList',
    component: MyGoodsList,
    name: 'MyGoodsList'
  },
  {
    path: '/myGoodsSearch',
    component: MyGoodsSearch,
    name: 'MyGoodsSearch'
  },
  {
    path: '/myUserInfo',
    component: MyUserInfo,
    name: 'MyUserInfo'
  }
]

const router = new VueRouter({
  routes
})

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

export default router